package name.fowler.refactoring.simplestore;

import java.util.ArrayList;
import java.util.List;

public class Report {

	private String customerName;
	private double totalAmount = 0;
	private int frequentRenterPoints = 0;
	private List<String> movieDataList = new ArrayList<String>();

	public void addMovieData(String title, double amount) {
		movieDataList.add("\t" + title + "\t" + amount + "\n");
		totalAmount += amount;
	}

	public String toString() {
		String result = getHeader();
		for (String movieData : movieDataList) {
			result += movieData;
		}
		result += "Amount owed is " + totalAmount + "\n";
		result += "You earned " + frequentRenterPoints
				+ " frequent renter points.";
		return result;
	}

	private String getHeader() {
		return "Rental record for " + customerName + "\n";
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public void addFrequentRenterPoints(int bonus) {
		frequentRenterPoints += bonus;

	}
}
